<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: D:/Projects/MiXiM/extsrc/mixim/src/base/phyLayer/Signal_.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00305.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">Signal_.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef SIGNAL_H_</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define SIGNAL_H_</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;list&gt;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;omnetpp.h&gt;</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="preprocessor">#include &quot;MiXiMDefs.h&quot;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;Mapping.h&quot;</span>
<a name="l00009"></a>00009 
<a name="l00033"></a><a class="code" href="a00192.html">00033</a> <span class="keyword">class </span>MIXIM_API <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> {
<a name="l00034"></a>00034 <span class="keyword">public</span>:
<a name="l00040"></a><a class="code" href="a00192.html#a484a5f8dfebfd933edcb1a55770df0e2">00040</a>   <span class="keyword">typedef</span> <a class="code" href="a00049.html" title="Defines it values by concatenating one or more Mappings to a reference Mapping.">ConcatConstMapping&lt;std::multiplies&lt;double&gt;</a> &gt; <a class="code" href="a00192.html#a484a5f8dfebfd933edcb1a55770df0e2" title="Shortcut type for a concatenated Mapping using multiply operator.">MultipliedMapping</a>;
<a name="l00042"></a><a class="code" href="a00192.html#a463671c45cf3099eb81d8840c86a27b4">00042</a>   <span class="keyword">typedef</span> std::list&lt;ConstMapping*&gt; <a class="code" href="a00192.html#a463671c45cf3099eb81d8840c86a27b4" title="Shortcut type for a list of ConstMappings.">ConstMappingList</a>;
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 <span class="keyword">protected</span>:
<a name="l00046"></a><a class="code" href="a00192.html#a3e9509d6f61f45994b1bf49d319e4b31">00046</a>   <span class="keywordtype">int</span> <a class="code" href="a00192.html#a3e9509d6f61f45994b1bf49d319e4b31" title="Sender module id, additional definition here because BasePhyLayer will do some selfMessages with AirF...">senderModuleID</a>;
<a name="l00048"></a><a class="code" href="a00192.html#a7355857ae0852dfe9e415d475585396b">00048</a>   <span class="keywordtype">int</span> <a class="code" href="a00192.html#a7355857ae0852dfe9e415d475585396b" title="Sender gate id, additional definition here because BasePhyLayer will do some selfMessages with AirFra...">senderFromGateID</a>;
<a name="l00050"></a><a class="code" href="a00192.html#a44ca8e70f7bd86a8af28bd382bea7434">00050</a>   <span class="keywordtype">int</span> <a class="code" href="a00192.html#a44ca8e70f7bd86a8af28bd382bea7434" title="Receiver module id, additional definition here because BasePhyLayer will do some selfMessages with Ai...">receiverModuleID</a>;
<a name="l00052"></a><a class="code" href="a00192.html#a539dc4174aaa8ca81c7b40b9e39470fe">00052</a>   <span class="keywordtype">int</span> <a class="code" href="a00192.html#a539dc4174aaa8ca81c7b40b9e39470fe" title="Receiver gate id, additional definition here because BasePhyLayer will do some selfMessages with AirF...">receiverToGateID</a>;
<a name="l00054"></a><a class="code" href="a00192.html#a56c032041881146f469092037028affb">00054</a>   simtime_t <a class="code" href="a00192.html#a56c032041881146f469092037028affb" title="The start of the signal transmission at the sender module.">sendingStart</a>;
<a name="l00056"></a><a class="code" href="a00192.html#a8073ad666fac40bf900fe0d9d6a88fa1">00056</a>   simtime_t <a class="code" href="a00192.html#a8073ad666fac40bf900fe0d9d6a88fa1" title="The duration of the signal transmission.">duration</a>;
<a name="l00058"></a><a class="code" href="a00192.html#a8549f666048ce96bcfd1b4d9c9a3e95b">00058</a>   simtime_t <a class="code" href="a00192.html#a8549f666048ce96bcfd1b4d9c9a3e95b" title="The propagation delay of the transmission.">propagationDelay</a>;
<a name="l00059"></a>00059 
<a name="l00061"></a><a class="code" href="a00192.html#a3570fb45af2a0f7580ee32c57e90e2b3">00061</a>   <a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* <a class="code" href="a00192.html#a3570fb45af2a0f7580ee32c57e90e2b3" title="Stores the function which describes the power of the signal.">power</a>;
<a name="l00062"></a>00062 
<a name="l00064"></a><a class="code" href="a00192.html#a4a6e1ad1165fc73157c8820739011e85">00064</a>   <a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* <a class="code" href="a00192.html#a4a6e1ad1165fc73157c8820739011e85" title="Stores the function which describes the bitrate of the signal.">bitrate</a>;
<a name="l00065"></a>00065 
<a name="l00067"></a><a class="code" href="a00192.html#ac60bce52288a4fc2067aa394918edf37">00067</a>   <a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* <a class="code" href="a00192.html#ac60bce52288a4fc2067aa394918edf37" title="If propagation delay is not zero this stores the undelayed bitrate.">txBitrate</a>;
<a name="l00068"></a>00068 
<a name="l00070"></a><a class="code" href="a00192.html#a1fb9da7932d7c4746f2afaaa21153cce">00070</a>   <a class="code" href="a00192.html#a463671c45cf3099eb81d8840c86a27b4" title="Shortcut type for a list of ConstMappings.">ConstMappingList</a> <a class="code" href="a00192.html#a1fb9da7932d7c4746f2afaaa21153cce" title="Stores the functions describing the attenuations of the signal.">attenuations</a>;
<a name="l00071"></a>00071 
<a name="l00076"></a><a class="code" href="a00192.html#a9e3d433a61e8188c8a6de5b540da8d5e">00076</a>   <span class="keyword">mutable</span> <a class="code" href="a00049.html" title="Defines it values by concatenating one or more Mappings to a reference Mapping.">MultipliedMapping</a>* <a class="code" href="a00192.html#a9e3d433a61e8188c8a6de5b540da8d5e" title="Stores the mapping defining the receiving power of the signal.">rcvPower</a>;
<a name="l00077"></a>00077 
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
<a name="l00085"></a><a class="code" href="a00192.html#a594e926b3d8ff3330375c8850699ae76">00085</a>   <span class="keywordtype">void</span> <a class="code" href="a00192.html#a594e926b3d8ff3330375c8850699ae76" title="Deletes the rcvPower mapping member because it became out-dated.">markRcvPowerOutdated</a>() {
<a name="l00086"></a>00086     <span class="keywordflow">if</span>(rcvPower){
<a name="l00087"></a>00087       <span class="keywordflow">if</span>(propagationDelay != 0) {
<a name="l00088"></a>00088         assert(rcvPower-&gt;getRefMapping() != power);
<a name="l00089"></a>00089         <span class="keyword">delete</span> rcvPower-&gt;getRefMapping();
<a name="l00090"></a>00090       }
<a name="l00091"></a>00091       <span class="keyword">delete</span> rcvPower;
<a name="l00092"></a>00092       rcvPower = 0;
<a name="l00093"></a>00093     }
<a name="l00094"></a>00094   }
<a name="l00095"></a>00095 <span class="keyword">public</span>:
<a name="l00096"></a>00096 
<a name="l00100"></a>00100   <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>(simtime_t_cref start = -1.0, simtime_t_cref length = -1.0);
<a name="l00101"></a>00101 
<a name="l00106"></a>00106   <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>(<span class="keyword">const</span> <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>&amp; o);
<a name="l00107"></a>00107 
<a name="l00112"></a>00112   <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>&amp; operator=(<span class="keyword">const</span> <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>&amp; o);
<a name="l00113"></a>00113 
<a name="l00122"></a>00122   <span class="keywordtype">void</span> swap(<a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>&amp;);
<a name="l00123"></a>00123 
<a name="l00127"></a>00127   ~<a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>();
<a name="l00128"></a>00128 
<a name="l00133"></a>00133   simtime_t_cref getSendingStart() <span class="keyword">const</span>;
<a name="l00134"></a>00134 
<a name="l00139"></a>00139   simtime_t getSendingEnd() <span class="keyword">const</span>;
<a name="l00140"></a>00140 
<a name="l00145"></a>00145   simtime_t getReceptionStart() <span class="keyword">const</span>;
<a name="l00146"></a>00146 
<a name="l00151"></a>00151   simtime_t getReceptionEnd() <span class="keyword">const</span>;
<a name="l00152"></a>00152 
<a name="l00156"></a>00156   simtime_t_cref getDuration() <span class="keyword">const</span>;
<a name="l00157"></a>00157 
<a name="l00161"></a>00161   simtime_t_cref getPropagationDelay() <span class="keyword">const</span>;
<a name="l00162"></a>00162 
<a name="l00168"></a>00168   <span class="keywordtype">void</span> setPropagationDelay(simtime_t_cref delay);
<a name="l00169"></a>00169 
<a name="l00176"></a>00176   <span class="keywordtype">void</span> setTransmissionPower(<a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* power);
<a name="l00177"></a>00177 
<a name="l00183"></a>00183   <span class="keywordtype">void</span> setBitrate(<a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* bitrate);
<a name="l00184"></a>00184 
<a name="l00190"></a><a class="code" href="a00192.html#a0beeef0f27c33145a0fca521df1c5f5c">00190</a>   <span class="keywordtype">void</span> <a class="code" href="a00192.html#a0beeef0f27c33145a0fca521df1c5f5c" title="Adds a function representing an attenuation of the signal.">addAttenuation</a>(<a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* att) {
<a name="l00191"></a>00191     <span class="comment">//assert the attenuation wasn&#39;t already added to the list before</span>
<a name="l00192"></a>00192     assert(std::find(attenuations.begin(), attenuations.end(), att) == attenuations.end());
<a name="l00193"></a>00193 
<a name="l00194"></a>00194     attenuations.push_back(att);
<a name="l00195"></a>00195 
<a name="l00196"></a>00196     <span class="keywordflow">if</span>(rcvPower)
<a name="l00197"></a>00197       rcvPower-&gt;addMapping(att);
<a name="l00198"></a>00198   }
<a name="l00199"></a>00199 
<a name="l00207"></a><a class="code" href="a00192.html#a392ecf1a624edfb90243e7227370a772">00207</a>   <a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* <a class="code" href="a00192.html#a392ecf1a624edfb90243e7227370a772" title="Returns the function representing the transmission power of the signal.">getTransmissionPower</a>() {
<a name="l00208"></a>00208     <span class="keywordflow">return</span> power;
<a name="l00209"></a>00209   }
<a name="l00210"></a>00210 
<a name="l00218"></a><a class="code" href="a00192.html#a5e8552f0d95e8faea2dee32ee7ba7212">00218</a>   <span class="keyword">const</span> <a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* <a class="code" href="a00192.html#a5e8552f0d95e8faea2dee32ee7ba7212" title="Returns the function representing the transmission power of the signal.">getTransmissionPower</a>()<span class="keyword"> const </span>{
<a name="l00219"></a>00219     <span class="keywordflow">return</span> power;
<a name="l00220"></a>00220   }
<a name="l00221"></a>00221 
<a name="l00226"></a><a class="code" href="a00192.html#afcfa26a0f384f475a019446b33c7458d">00226</a>   <span class="keyword">const</span> <a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* <a class="code" href="a00192.html#afcfa26a0f384f475a019446b33c7458d" title="Returns the function representing the bitrate of the signal.">getBitrate</a>()<span class="keyword"> const </span>{
<a name="l00227"></a>00227     <span class="keywordflow">return</span> bitrate;
<a name="l00228"></a>00228   }
<a name="l00229"></a>00229 
<a name="l00234"></a><a class="code" href="a00192.html#a9b949d4e6bd18f6baccd66748c2bcd78">00234</a>   <span class="keyword">const</span> <a class="code" href="a00192.html#a463671c45cf3099eb81d8840c86a27b4" title="Shortcut type for a list of ConstMappings.">ConstMappingList</a>&amp; <a class="code" href="a00192.html#a9b949d4e6bd18f6baccd66748c2bcd78" title="Returns a list of functions representing the attenuations of the signal.">getAttenuation</a>()<span class="keyword"> const </span>{
<a name="l00235"></a>00235     <span class="keywordflow">return</span> attenuations;
<a name="l00236"></a>00236   }
<a name="l00237"></a>00237 
<a name="l00245"></a><a class="code" href="a00192.html#a78255d9a9f6c3bffb72a51ce48e2fbb9">00245</a>   <span class="keyword">const</span> <a class="code" href="a00049.html" title="Defines it values by concatenating one or more Mappings to a reference Mapping.">MultipliedMapping</a>* <a class="code" href="a00192.html#a78255d9a9f6c3bffb72a51ce48e2fbb9" title="Calculates and returns the receiving power of this Signal. Ownership of the returned mapping belongs ...">getReceivingPower</a>()<span class="keyword"> const </span>{
<a name="l00246"></a>00246     <span class="keywordflow">if</span>(!rcvPower)
<a name="l00247"></a>00247     {
<a name="l00248"></a>00248       <a class="code" href="a00058.html" title="Represents a not changeable mapping (mathematical function) from domain with at least the time to a A...">ConstMapping</a>* tmp = power;
<a name="l00249"></a>00249       <span class="keywordflow">if</span>(propagationDelay != 0) {
<a name="l00250"></a>00250         tmp = <span class="keyword">new</span> <a class="code" href="a00056.html" title="Moves another ConstMapping in its time dimension.">ConstDelayedMapping</a>(power, propagationDelay);
<a name="l00251"></a>00251         <span class="comment">// tmp will be deleted in ~Signal(), where rcvPower-&gt;getRefMapping()</span>
<a name="l00252"></a>00252         <span class="comment">// will be used for accessing this pointer</span>
<a name="l00253"></a>00253       }
<a name="l00254"></a>00254       rcvPower = <span class="keyword">new</span> <a class="code" href="a00049.html" title="Defines it values by concatenating one or more Mappings to a reference Mapping.">MultipliedMapping</a>( tmp
<a name="l00255"></a>00255                                       , attenuations.begin()
<a name="l00256"></a>00256                                       , attenuations.end()
<a name="l00257"></a>00257                                       , false
<a name="l00258"></a>00258                                       , <a class="code" href="a00013.html#a8523627cdc70492e5e0935b9a3a78cc4" title="Zero value of a Argument value.">Argument::MappedZero</a> );
<a name="l00259"></a>00259     }
<a name="l00260"></a>00260 
<a name="l00261"></a>00261     <span class="keywordflow">return</span> rcvPower;
<a name="l00262"></a>00262   }
<a name="l00263"></a>00263 
<a name="l00269"></a><a class="code" href="a00192.html#ac78bb49ae3090d9954722feaad3e88ae">00269</a>   cModule *<a class="code" href="a00192.html#ac78bb49ae3090d9954722feaad3e88ae">getReceptionModule</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> receiverModuleID &lt; 0 ? NULL : simulation.getModule(receiverModuleID);}
<a name="l00270"></a>00270 
<a name="l00276"></a>00276   cGate *getReceptionGate() <span class="keyword">const</span>;
<a name="l00277"></a>00277 
<a name="l00283"></a><a class="code" href="a00192.html#a2edb4eb1bb7cb96f389999ba624ad5bd">00283</a>   cModule *<a class="code" href="a00192.html#a2edb4eb1bb7cb96f389999ba624ad5bd">getSendingModule</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> senderModuleID &lt; 0 ? NULL : simulation.getModule(senderModuleID);}
<a name="l00284"></a>00284 
<a name="l00290"></a>00290   cGate *getSendingGate() <span class="keyword">const</span>;
<a name="l00291"></a>00291 
<a name="l00293"></a>00293   <span class="keywordtype">void</span> setReceptionSenderInfo(<span class="keyword">const</span> cMessage *<span class="keyword">const</span> pMsg);
<a name="l00294"></a>00294 };
<a name="l00295"></a>00295 
<a name="l00296"></a>00296 <span class="preprocessor">#endif </span><span class="comment">/*SIGNAL_H_*/</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>Signal_.h</b>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:30 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
